<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<style type="text/css">
.pageFormContent p {
	width: 600px;
}

.req {
	color: red;
}
</style>
<!--新增学校页面 -->
<div class="pageContent">
	<form method="post" 
		action="school_${empty sclId ? 'add':'edit' }.action"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent nowrap" layoutH="56">
			<fieldset>
				<legend>基本信息</legend>
				<p>
					<label>学校名称</label> 
					<input name="sclName" class="required"
						type="text" value="" />
				</p>
				<p>
					<label>学校地址</label> <input name="sclAddr" type="text" value="" />
				</p>
				<%-- <p>
					<label>所属地区</label> 
					<select name="areaCode" class="required combox"
					onchange="javascript:select_scl_add_area_change(this);"
					ref="scl_add_osu_mobuser_list"
					refUrl="outsideUser_getSimpleByAreaCode.action?areaCode={value}&osuType=1"
					>
						<option value="">---请选择---</option>
						<c:forEach items="${application.areaList }" var="area">
							<option value="${area.areaCode}">${area.areaName}</option>
						</c:forEach>
					</select>
				</p> --%>
				<p>
				<label>所属市：</label>
				<select
					name="areaCode" 
					class="required combox" id="areaCode" ref="school_area_county" refUrl="school_getAreaByCity.action?areaCode={value}">
					<option value="">---所有地区---</option>
					<c:forEach items="${application.areaList}" var="area">
						<option ${areaCode==area.areaCode?"selected":""}  value="${area.areaCode }">${area.areaName}</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>所属县区：</label>
				<select
					name="countyCode" 
					class="required combox" id="school_area_county" onchange="select_scl_add_area_change(this)"
					ref="scl_add_osu_mobuser_list"
					refUrl="outsideUser_getSimpleByAreaCode.action?areaCode={value}&osuType=1">
					<option value="">---所有县区---</option>
				</select>
			</p>
				<p>
					<label>联系电话</label> <input class="phone" name="sclPhone"
						type="text" value="" /> <span class="info">&nbsp;&nbsp;区号-尾号/手机号码</span>
				</p>
				
				<p>
					<label>学校联络人姓名</label> <input name="sclLeaderName" type="text"
						value="" />
				</p>
				<p>
					<label>学校联络人电话</label> <input class="phone" name="sclLeaderPhone"
						class="required" type="text" value="" /> <span class="info">&nbsp;&nbsp;区号-尾号/手机号码</span>
				</p>
				<%-- 
				<p>
					<label>卡预留扇区号</label> <select class="combox"
						name="cardReservedArea">
						<c:forEach var="i" begin="0" end="15" step="1">
							<option value='${i}' <c:if test="${i==15}">selected</c:if>>${i}</option>
						</c:forEach>
					</select> <span class="info">&nbsp;&nbsp;卡预留扇区不会被加密，供其他厂商使用，默认为15扇区</span>
				</p>
				--%>
				<p>
					<label>学校简介：</label>
					<textarea name="sclSummary" rows="2" cols="30"></textarea>
				</p>
				<p></p>
				<p></p>
				<p></p>
			</fieldset>
			<br>
			<fieldset>
				<legend>扩展信息</legend>
				<p>
					<label>移动客户经理</label> 
					<select name="schoolRelation.mobManagerId"
						id="scl_add_osu_mobuser_list"
						class="required combox">
						<option value="">---请选择---</option>
						<%--
						<c:forEach items="${mobManagerList}" var="mobManager">
							<option value="${mobManager.osuId }">${mobManager.osuName }-${fn:substring(mobManager.osuPhone,fn:length(mobManager.osuPhone)-4,fn:length(mobManager.osuPhone))}</option>
						</c:forEach>
						 --%>
					</select>
					<span class="info"><span class="req">*</span>姓名-手机后四位</span>
				</p>
				<p>
					<label>学校管理人员</label> 
					<select name="schoolRelation.sclManagerId"
						id="scl_add_osu_mgr_list"
						class="combox">
						<option value="">---请选择---</option>
						<%--
						<c:forEach items="${sclManagerList}" var="sclManager">
							<option value="${sclManager.osuId }">${sclManager.osuName }-${fn:substring(sclManager.osuPhone,fn:length(sclManager.osuPhone)-4,fn:length(sclManager.osuPhone))}</option>
						</c:forEach>
						 --%>
					</select>
					<span class="info">&nbsp;姓名-手机号码后四位</span>
				</p>
				<p>
					<label>拓展人员</label><select name="schoolRelation.saleUserId"
						class="required combox">
						<option value="">---请选择---</option>
						<c:forEach items="${saleList}" var="saleUser">
							<option value="${saleUser.isuId }">${saleUser.isuName }</option>
						</c:forEach>
					</select>
					<span class="req">*</span>
				</p>
				<%-- <p>
					<label>客服人员</label> <select name="schoolRelation.csUserId"
						class="combox">
						<option value="">---请选择---</option>
						<c:forEach items="${customServiceList}" var="csUser">
							<option value="${csUser.isuId }">${csUser.isuName }</option>
						</c:forEach>
					</select>
					<!-- 
					<span class="req">*</span>
					 -->
				</p> --%>
				<p>
					<label>维护人员</label> <select name="schoolRelation.saleKeepId"
						class="combox">
						<option value="">---请选择---</option>
						<c:forEach items="${maintainList}" var="maintainUser">
							<option value="${maintainUser.isuId }">${maintainUser.isuName }</option>
						</c:forEach>
					</select>
				</p>
				<p>
					<label>卡类型</label>
					<select name="schoolRelation.cardTypeFlag"
						class="required combox">
						<option value="">---请选择---</option>
						<option value="0">M1卡</option>
						<option value="1">射频卡</option>
					</select><span class="info"></span>
					<span class="req">*</span>
				</p>
				<p>
					<label>发卡方</label>
					<select name="schoolRelation.cardIssusrFlag"
						class="required combox">
						<option value="">---请选择---</option>
						<option value="0">第三方</option>
						<option value="1">我方</option>
					</select>
					<span class="req">*</span>
				</p>
				<p>
					<label>结算方式</label>
					<select name="schoolRelation.balanceTypeFlag"
						class="required combox">
						<option value="">---请选择---</option>
						<c:forEach items="${blanceTypeList }" var="blance">
							<option ${schoolRelation.balanceTypeFlag==blance.dicCode?"selected":"" } value="${blance.dicCode}">${blance.dicName}</option>
						</c:forEach>
					</select>
					<span class="req">*</span>
				</p>
				<p>
					<label>激励方式</label> 
					<select
						name="schoolRelation.marketingTypeFlag" class="required combox"
						id="marketingTypeFlag" onchange="scl_add_mktf_change()">
						<option value="">---请选择---</option>
						<c:forEach items="${marketingTypeList }" var="marketing">
							<option ${schoolRelation.marketingTypeFlag==marketing.dicCode?"selected":"" } value="${marketing.dicCode}">${marketing.dicName}</option>
						</c:forEach>
					</select>
					<span class="req">*</span>
					<!-- 
					<span class="req">*</span>
					 -->
				</p>
				<p>
					<label>备注：</label>
					<textarea name="schoolRelation.remark" id="marketingContent" rows="2" cols="25"></textarea>
				</p>
				<p></p>
				<p></p>
			</fieldset>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script type="text/javascript">
	function scl_add_mktf_change(){
		var marketingTypeFlag=document.getElementById("marketingTypeFlag");
		var marketingContent=document.getElementById("marketingContent");
		if(marketingTypeFlag.value=='3'){
			marketingContent.className="required";
			marketingContent.setAttribute("minLength","30");
		}else{
			marketingContent.className="textInput";
		}
	}
	
	// 地区下拉列表变动事件  dwz级联控制移动客户经理选择 ，该事件控制学校管理员选择
	function select_scl_add_area_change(obj){
		$.post("outsideUser_getSimpleByAreaCode.action",{
			"areaCode" : obj.value,
			"osuType" : 0
		},function(data){
			var html = '';
			for (var i = 0; i < data.length; i++) {
				html += '<option value="'+data[i][0]+'">' + data[i][1]
						+ '</option>';
			}
			var $ref = $("#scl_add_osu_mgr_list", navTab.getCurrentPanel());
			var $refCombox = $ref.parents("div.combox:first");
			$ref.html(html).insertAfter($refCombox);
			$refCombox.remove();
			$ref.combox();
		}, "json");
	}
</script>